* Some VAR-GMM command and predictive command new tables

* Simple VAR
pvar lSENTIMENT lVIX lTERM_SPREAD EQ_RETURN SP500 lroll return lvolume

* GMM VAR results reported

pvar lSENTIMENT lVIX SP500 lTERM_SPREAD return EQ_RETURN lroll LEVERAGE lvolume, fod instlags(1/3) gmmstyle
* This is my Panel B 
* Predictive 
reg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.SP500 l.LEVERAGE TERM_SPREAD  i.firm i.trend, robust
reg lSENTIMENT L(1/3).volume  l.return l.EQ_RETURN l.roll  l.VIX l.SP500 l.LEVERAGE l.TERM_SPREAD  i.firm i.trend, robust
* this is my Panel A 
reg d.cds L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE TERM_SPREAD  i.firm i.trend, robust
* This is my table 4 (can go in appendix)

* Estimates with sell/buy initiated and insitutional==fundamental traders ///
* and extrapolators. 
* Sale initiated == negative return 1
* Buy initiated == positive return 0
* Fundmenatl traders are above the median trading volume==1 & 0 otherwise "median_inst"
* and above the 75th percentile of trading volume==9 & 0 otherwise "perc_inst"

xtreg return L(1/3).SENTIMENT , fe
xtreg return L(1/3).SENTIMENT   l.EQ_RETURN l.roll l.VIX ///
l.LEVERAGE l.TERM_SPREAD l.log_sales, fe
* Above is my Table 4

*reg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE TERM_SPREAD  i.firm i.trend if trade==1, robust
*estimates store m1

*reg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE TERM_SPREAD  i.firm i.trend if trade==0, robust
*estimates store m2
*________________________________________________________
* --------- New Table 4 with extrpoalators & buy/sell
* Sale initiated == negative return ; trade==1
* Buy initiated == positive return ; trade==0
* Fundmenatl traders above the median trading median_inst==1 & 
* Extrapolators/hedge funds median_inst==0 these are trades below the median
* Panel A: Volume (as dependent variable)
*--- Fundamental/extrpolators
xtreg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if median_inst ==1, fe
xtreg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if median_inst ==0, fe
* --- Sell-initiated Buy-initiated ---------
xtreg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if trade==1, fe
xtreg lvolume L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if trade==0, fe


* Panel B: Returns (as dependent variable)
*--- Fundamental/extrpolators
xtreg return L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if median_inst ==1, fe
xtreg return L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if median_inst ==0, fe
* --- Sell-initiated Buy-initiated ---------
xtreg return L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if trade==1, fe
xtreg return L(1/3).SENTIMENT l.return l.EQ_RETURN l.roll  l.VIX l.LEVERAGE ///
TERM_SPREAD  if trade==0, fe
